Integrand size = 14, antiderivative size = 63 \[ \int \frac {\csc (x)}{(a \cos (x)+b \sin (x))^2} \, dx=-\frac {\text {arctanh}(\cos (x))}{a^2}+\frac {b \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{a^2 \sqrt {a^2+b^2}}+\frac {1}{a (a \cos (x)+b \sin (x))} \]
[Out]
Time = 0.07 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3172, 3855, 3153, 212} \[ \int \frac {\csc (x)}{(a \cos (x)+b \sin (x))^2} \, dx=\frac {b \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{a^2 \sqrt {a^2+b^2}}-\frac {\text {arctanh}(\cos (x))}{a^2}+\frac {1}{a (a \cos (x)+b \sin (x))} \]
[In]
[Out]
Rule 212
Rule 3153
Rule 3172
Rule 3855
Rubi steps \begin{align*} \text {integral}& = \frac {1}{a (a \cos (x)+b \sin (x))}+\frac {\int \csc (x) \, dx}{a^2}-\frac {b \int \frac {1}{a \cos (x)+b \sin (x)} \, dx}{a^2} \\ & = -\frac {\text {arctanh}(\cos (x))}{a^2}+\frac {1}{a (a \cos (x)+b \sin (x))}+\frac {b \text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,b \cos (x)-a \sin (x)\right )}{a^2} \\ & = -\frac {\text {arctanh}(\cos (x))}{a^2}+\frac {b \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{a^2 \sqrt {a^2+b^2}}+\frac {1}{a (a \cos (x)+b \sin (x))} \\ \end{align*}
Time = 0.61 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.14 \[ \int \frac {\csc (x)}{(a \cos (x)+b \sin (x))^2} \, dx=\frac {-\frac {2 b \text {arctanh}\left (\frac {-b+a \tan \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}+\frac {a \csc (x)}{b+a \cot (x)}-\log \left (\cos \left (\frac {x}{2}\right )\right )+\log \left (\sin \left (\frac {x}{2}\right )\right )}{a^2} \]
[In]
[Out]
Time = 0.56 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.35
method | result | size |
default | \(\frac {\frac {4 \left (-\frac {b \tan \left (\frac {x}{2}\right )}{2}-\frac {a}{2}\right )}{\tan \left (\frac {x}{2}\right )^{2} a -2 b \tan \left (\frac {x}{2}\right )-a}-\frac {2 b \,\operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}}}{a^{2}}+\frac {\ln \left (\tan \left (\frac {x}{2}\right )\right )}{a^{2}}\) | \(85\) |
risch | \(\frac {2 \,{\mathrm e}^{i x}}{a \left (-i b \,{\mathrm e}^{2 i x}+a \,{\mathrm e}^{2 i x}+i b +a \right )}-\frac {i b \ln \left ({\mathrm e}^{i x}-\frac {i b +a}{\sqrt {-a^{2}-b^{2}}}\right )}{\sqrt {-a^{2}-b^{2}}\, a^{2}}+\frac {i b \ln \left ({\mathrm e}^{i x}+\frac {i b +a}{\sqrt {-a^{2}-b^{2}}}\right )}{\sqrt {-a^{2}-b^{2}}\, a^{2}}-\frac {\ln \left ({\mathrm e}^{i x}+1\right )}{a^{2}}+\frac {\ln \left ({\mathrm e}^{i x}-1\right )}{a^{2}}\) | \(156\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 220 vs. \(2 (59) = 118\).
Time = 0.29 (sec) , antiderivative size = 220, normalized size of antiderivative = 3.49 \[ \int \frac {\csc (x)}{(a \cos (x)+b \sin (x))^2} \, dx=\frac {2 \, a^{3} + 2 \, a b^{2} + {\left (a b \cos \left (x\right ) + b^{2} \sin \left (x\right )\right )} \sqrt {a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, a^{2} - b^{2} - 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (x\right ) - a \sin \left (x\right )\right )}}{2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}}\right ) - {\left ({\left (a^{3} + a b^{2}\right )} \cos \left (x\right ) + {\left (a^{2} b + b^{3}\right )} \sin \left (x\right )\right )} \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) + {\left ({\left (a^{3} + a b^{2}\right )} \cos \left (x\right ) + {\left (a^{2} b + b^{3}\right )} \sin \left (x\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right )}{2 \, {\left ({\left (a^{5} + a^{3} b^{2}\right )} \cos \left (x\right ) + {\left (a^{4} b + a^{2} b^{3}\right )} \sin \left (x\right )\right )}} \]
[In]
[Out]
\[ \int \frac {\csc (x)}{(a \cos (x)+b \sin (x))^2} \, dx=\int \frac {\csc {\left (x \right )}}{\left (a \cos {\left (x \right )} + b \sin {\left (x \right )}\right )^{2}}\, dx \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 128 vs. \(2 (59) = 118\).
Time = 0.30 (sec) , antiderivative size = 128, normalized size of antiderivative = 2.03 \[ \int \frac {\csc (x)}{(a \cos (x)+b \sin (x))^2} \, dx=\frac {2 \, {\left (a + \frac {b \sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}}{a^{3} + \frac {2 \, a^{2} b \sin \left (x\right )}{\cos \left (x\right ) + 1} - \frac {a^{3} \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}}} + \frac {b \log \left (\frac {b - \frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{\sqrt {a^{2} + b^{2}} a^{2}} + \frac {\log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}{a^{2}} \]
[In]
[Out]
none
Time = 0.31 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.73 \[ \int \frac {\csc (x)}{(a \cos (x)+b \sin (x))^2} \, dx=\frac {b \log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, x\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, x\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{\sqrt {a^{2} + b^{2}} a^{2}} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right )}{a^{2}} - \frac {2 \, {\left (b \tan \left (\frac {1}{2} \, x\right ) + a\right )}}{{\left (a \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, b \tan \left (\frac {1}{2} \, x\right ) - a\right )} a^{2}} \]
[In]
[Out]
Time = 21.95 (sec) , antiderivative size = 492, normalized size of antiderivative = 7.81 \[ \int \frac {\csc (x)}{(a \cos (x)+b \sin (x))^2} \, dx=\frac {\frac {2}{a}+\frac {2\,b\,\mathrm {tan}\left (\frac {x}{2}\right )}{a^2}}{-a\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,b\,\mathrm {tan}\left (\frac {x}{2}\right )+a}+\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )}{a^2}+\frac {b\,\mathrm {atan}\left (\frac {\frac {b\,\sqrt {a^2+b^2}\,\left (4\,b+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (a^2+4\,b^2\right )}{a}+\frac {b\,\left (2\,a^2\,b+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (3\,a^4+4\,a^2\,b^2\right )}{a}\right )\,\sqrt {a^2+b^2}}{a^4+a^2\,b^2}\right )\,1{}\mathrm {i}}{a^4+a^2\,b^2}+\frac {b\,\sqrt {a^2+b^2}\,\left (4\,b+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (a^2+4\,b^2\right )}{a}-\frac {b\,\left (2\,a^2\,b+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (3\,a^4+4\,a^2\,b^2\right )}{a}\right )\,\sqrt {a^2+b^2}}{a^4+a^2\,b^2}\right )\,1{}\mathrm {i}}{a^4+a^2\,b^2}}{\frac {4\,b}{a^2}+\frac {b\,\sqrt {a^2+b^2}\,\left (4\,b+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (a^2+4\,b^2\right )}{a}+\frac {b\,\left (2\,a^2\,b+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (3\,a^4+4\,a^2\,b^2\right )}{a}\right )\,\sqrt {a^2+b^2}}{a^4+a^2\,b^2}\right )}{a^4+a^2\,b^2}-\frac {b\,\sqrt {a^2+b^2}\,\left (4\,b+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (a^2+4\,b^2\right )}{a}-\frac {b\,\left (2\,a^2\,b+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (3\,a^4+4\,a^2\,b^2\right )}{a}\right )\,\sqrt {a^2+b^2}}{a^4+a^2\,b^2}\right )}{a^4+a^2\,b^2}}\right )\,\sqrt {a^2+b^2}\,2{}\mathrm {i}}{a^4+a^2\,b^2} \]
[In]
[Out]